<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
	<meta charset="UTF-8">
	<title>捐赠-我要捐赠</title>
	<link rel="stylesheet" href="/css/bootstrap.min.css">
	<link rel="stylesheet" href="/css/index.css">
	<!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
	<link href="/css/materialdesignicons.min.css" rel="stylesheet">
	<link href="/css/style.min.css" rel="stylesheet">
	<script src="/js/jquery.min.js"></script>
	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
	<script src="/js/bootstrap.min.js"></script>
</head>
<body class="body">
<div th:insert="~{navigation :: copy}"></div>
<div class="container">
	<h2>我要捐赠</h2>
	<hr>
	<div class="row">
		<div class="col-lg-8">
			<form action="/don/addDon" method="post" class="row" id="form1">
				<div class="form-group col-md-12"></div>
				<div class="form-group col-md-10">
					<label for="donName">捐赠名称</label>
					<input type="text" class="form-control" id="donName" name="donName" placeholder="我要捐赠的项目名"  required="required"/>
				</div>

				<div class="form-group col-md-12"></div>
				<div class="form-group col-md-10">
					<label for="donDesc">捐赠内容</label>
					<textarea type="text" class="form-control" id="donDesc" name="donDesc"  placeholder="具体介绍" required="required"></textarea>
				</div>


				<div class="form-group col-md-12">
					<button type="button" class="btn btn-primary ajax-post" target-form="add-form" onclick="addAss()">确 定</button>
					<button type="button" class="btn btn-default" onclick="javascript:history.back(-1);return false;">返 回</button>
				</div>
			</form>

		</div>
	</div>
</div>
<script type="text/javascript" src="/js/axios.min.js"></script>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript">

    function addAss() {
        axios.post('/don/addDon',$('#form1').serialize())
            .then(function (response) {
                var data=response.data;
                if(data==1){
                    alert("创建成功，请等待审核");
                    location.href="/don/getAllDon"
                }else {
                    alert("创建失败，再次检查信息");
                }
            }).catch(function (error) {
            alert("创建失败，请审核信息是否有误")
        })
    }

</script>
</body>
</html>